import request from '@/api/utils/requery'

//角色列表

//编辑角色
export const EditeRole = (array) => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: "role/update",
        data: array,
    })
}

//删除角色
export const DeleteRole = data => {
    return request({
        method: 'post',
        url:`role/delete?roleId=${data}`
    })
}

//查看权限
export const WatchRole = data => request({
    url:`resource/selectOne?roleId=${data}`
})

//获取所有权限
export const GetAllAuthority = () => request({
    url:"resource/selectAll"
})

//提交权限修改
export const EditeAuthority = (id,Array) => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: `resource/save?roleId=${id}`,
        data: Array,
    })
}

//删除权限
export const DeleteAuthority = (id,deleteid) => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: `resource/deleteRel?roleId=${id}`,
        data: deleteid,
    })
}

//增加权限
export const AddAuthority = array => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: `resource/insert`,
        data: array,
    })
}

//更新权限
export const UpdateAuthority = array => {
    return request({
        method: "post",
        headers: {
          "Content-Type": "application/json",
        },
        url: "resource/update",
        data: array,
    })
}

//删除权限
export const DeleteAuth = data => request({
    method: 'post',
    url:`resource/delete?resourceId=${data}`
})